package com.dcd.controller;

import com.dcd.pojo.Brand;
import com.dcd.service.BrandService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
@RequestMapping("/BrandController")
public class BrandController {

    @Autowired
    private BrandService brandService;

    /**
     * 查询前32个热门品牌/根据指定首写字母查询
     * @param brand_first_letter 热门品牌/首字 母
     * @param whether_only_on_sale 是否为在售
     * @return
     */
    @RequestMapping("/select_popularity_brand/{brand_first_letter}/{whether_only_on_sale}")
    public List<Brand> select_popularity_brand(@PathVariable String brand_first_letter,@PathVariable String whether_only_on_sale) {
        return brandService.select_popularity_brand(brand_first_letter,whether_only_on_sale);
    }

    /**
     * 查询指定品牌信息
     *
     * @param brand_id 品牌id
     * @return
     */
    @RequestMapping("/select_brand_mess_by_id/{brand_id}")
    public Brand select_brand_mess_by_id(@PathVariable int brand_id){
        return brandService.select_brand_mess_by_id(brand_id);
    }

    /**
     * 查询所有品牌(购车计算)
     * 查询所有品牌(排行榜)
     * @return
     */
    @RequestMapping("/select_brandAll")
    public List<Brand> select_brandAll(){
        return brandService.select_brandAll();
    }


}
